//
//  HHProjectCell.m
//  osc
//
//  Created by AHUAN on 16/3/21.
//  Copyright © 2016年 hjl. All rights reserved.
//

#import "HHProjectCell.h"
#import "HHUser.h"
#import "HHProject.h"
#import <UIImageView+WebCache.h>


@interface HHProjectCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLable;
@property (weak, nonatomic) IBOutlet UILabel *tagLabel;
@property (weak, nonatomic) IBOutlet UILabel *shareLabel;
@property (weak, nonatomic) IBOutlet UILabel *starsLabel;
@property (weak, nonatomic) IBOutlet UILabel *seeLabel;

@end

@implementation HHProjectCell



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}


- (void)setProject:(HHProject *)project{
    _project = project;
    
    self.nameLabel.text = [NSString stringWithFormat:@"%@ / %@", project.owner.name, project.name];
    
    [self.headView sd_setImageWithURL:[NSURL URLWithString:project.owner.newportrait] placeholderImage:nil];
    self.contentLable.text = project.HHdescription;
    self.tagLabel.text = project.language;
    self.shareLabel.text = project.forks_count;
    self.starsLabel.text = project.stars_count;
    self.seeLabel.text = project.watches_count;
}

- (void)setFrame:(CGRect)frame{
    CGFloat margin = 6;
    frame.size.width -= 2 * margin;
    frame.origin.x += margin;
    frame.size.height -= margin;
    frame.origin.y += margin;
    
    [super setFrame:frame];
}
@end

